import { createRouter, createWebHashHistory } from 'vue-router';
import {beforeEach, loadRouter} from "/@/utils/router/router-util"
const routers = [
    {
        path: '/login',
        name: 'login',
        component: ()=> import("/@/views/login/index.vue")
    },
    {
        path: '/',
        name: 'index',
        component: ()=> import("/@/layout/index.vue"),
        children:[
            {
                path: '/personal/center',
                name: 'personalCenter',
                meta:{
                    title: '个人中心',
                    ancestor: [
                        {
                            name: 'personalCenter',
                            title: '个人中心',
                            affix: 2
                        }
                    ]
                },
                component:()=> import('/@/layout/page/PersonalCenter.vue')
            }
        ]
    }

]

export const router = createRouter({
    history: createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH),
    routes: routers,
    strict: true,
    scrollBehavior: () => ({ left: 0, top: 0 }),
});
beforeEach(router)

